<?php


/**
 * Base class that represents a query for the 'lectures' table.
 *
 *
 *
 * @method RcpLecturesQuery orderById($order = Criteria::ASC) Order by the id column
 * @method RcpLecturesQuery orderByGroupNameEn($order = Criteria::ASC) Order by the group_name_en column
 * @method RcpLecturesQuery orderByGroupNamePl($order = Criteria::ASC) Order by the group_name_pl column
 * @method RcpLecturesQuery orderByLanguageNamePl($order = Criteria::ASC) Order by the language_name_pl column
 * @method RcpLecturesQuery orderByLanguageNameEn($order = Criteria::ASC) Order by the language_name_en column
 * @method RcpLecturesQuery orderByTeacherId($order = Criteria::ASC) Order by the teacher_id column
 * @method RcpLecturesQuery orderByLastModified($order = Criteria::ASC) Order by the last_modified column
 * @method RcpLecturesQuery orderByCreated($order = Criteria::ASC) Order by the created column
 *
 * @method RcpLecturesQuery groupById() Group by the id column
 * @method RcpLecturesQuery groupByGroupNameEn() Group by the group_name_en column
 * @method RcpLecturesQuery groupByGroupNamePl() Group by the group_name_pl column
 * @method RcpLecturesQuery groupByLanguageNamePl() Group by the language_name_pl column
 * @method RcpLecturesQuery groupByLanguageNameEn() Group by the language_name_en column
 * @method RcpLecturesQuery groupByTeacherId() Group by the teacher_id column
 * @method RcpLecturesQuery groupByLastModified() Group by the last_modified column
 * @method RcpLecturesQuery groupByCreated() Group by the created column
 *
 * @method RcpLecturesQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method RcpLecturesQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method RcpLecturesQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method RcpLecturesQuery leftJoinUsers($relationAlias = null) Adds a LEFT JOIN clause to the query using the Users relation
 * @method RcpLecturesQuery rightJoinUsers($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Users relation
 * @method RcpLecturesQuery innerJoinUsers($relationAlias = null) Adds a INNER JOIN clause to the query using the Users relation
 *
 * @method RcpLecturesQuery leftJoinLecutreHourDefs($relationAlias = null) Adds a LEFT JOIN clause to the query using the LecutreHourDefs relation
 * @method RcpLecturesQuery rightJoinLecutreHourDefs($relationAlias = null) Adds a RIGHT JOIN clause to the query using the LecutreHourDefs relation
 * @method RcpLecturesQuery innerJoinLecutreHourDefs($relationAlias = null) Adds a INNER JOIN clause to the query using the LecutreHourDefs relation
 *
 * @method RcpLecturesQuery leftJoinLecutreHours($relationAlias = null) Adds a LEFT JOIN clause to the query using the LecutreHours relation
 * @method RcpLecturesQuery rightJoinLecutreHours($relationAlias = null) Adds a RIGHT JOIN clause to the query using the LecutreHours relation
 * @method RcpLecturesQuery innerJoinLecutreHours($relationAlias = null) Adds a INNER JOIN clause to the query using the LecutreHours relation
 *
 * @method RcpLecturesQuery leftJoinUserHasLecture($relationAlias = null) Adds a LEFT JOIN clause to the query using the UserHasLecture relation
 * @method RcpLecturesQuery rightJoinUserHasLecture($relationAlias = null) Adds a RIGHT JOIN clause to the query using the UserHasLecture relation
 * @method RcpLecturesQuery innerJoinUserHasLecture($relationAlias = null) Adds a INNER JOIN clause to the query using the UserHasLecture relation
 *
 * @method RcpLectures findOne(PropelPDO $con = null) Return the first RcpLectures matching the query
 * @method RcpLectures findOneOrCreate(PropelPDO $con = null) Return the first RcpLectures matching the query, or a new RcpLectures object populated from the query conditions when no match is found
 *
 * @method RcpLectures findOneById(int $id) Return the first RcpLectures filtered by the id column
 * @method RcpLectures findOneByGroupNameEn(string $group_name_en) Return the first RcpLectures filtered by the group_name_en column
 * @method RcpLectures findOneByGroupNamePl(string $group_name_pl) Return the first RcpLectures filtered by the group_name_pl column
 * @method RcpLectures findOneByLanguageNamePl(string $language_name_pl) Return the first RcpLectures filtered by the language_name_pl column
 * @method RcpLectures findOneByLanguageNameEn(string $language_name_en) Return the first RcpLectures filtered by the language_name_en column
 * @method RcpLectures findOneByTeacherId(int $teacher_id) Return the first RcpLectures filtered by the teacher_id column
 * @method RcpLectures findOneByLastModified(string $last_modified) Return the first RcpLectures filtered by the last_modified column
 * @method RcpLectures findOneByCreated(string $created) Return the first RcpLectures filtered by the created column
 *
 * @method array findById(int $id) Return RcpLectures objects filtered by the id column
 * @method array findByGroupNameEn(string $group_name_en) Return RcpLectures objects filtered by the group_name_en column
 * @method array findByGroupNamePl(string $group_name_pl) Return RcpLectures objects filtered by the group_name_pl column
 * @method array findByLanguageNamePl(string $language_name_pl) Return RcpLectures objects filtered by the language_name_pl column
 * @method array findByLanguageNameEn(string $language_name_en) Return RcpLectures objects filtered by the language_name_en column
 * @method array findByTeacherId(int $teacher_id) Return RcpLectures objects filtered by the teacher_id column
 * @method array findByLastModified(string $last_modified) Return RcpLectures objects filtered by the last_modified column
 * @method array findByCreated(string $created) Return RcpLectures objects filtered by the created column
 *
 * @package    propel.generator.rcp.om
 */
abstract class RcpBaseLecturesQuery extends ModelCriteria
{
    /**
     * Initializes internal state of RcpBaseLecturesQuery object.
     *
     * @param     string $dbName The dabase name
     * @param     string $modelName The phpName of a model, e.g. 'Book'
     * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
     */
    public function __construct($dbName = 'vgp_rcp', $modelName = 'RcpLectures', $modelAlias = null)
    {
        parent::__construct($dbName, $modelName, $modelAlias);
    }

    /**
     * Returns a new RcpLecturesQuery object.
     *
     * @param     string $modelAlias The alias of a model in the query
     * @param     RcpLecturesQuery|Criteria $criteria Optional Criteria to build the query from
     *
     * @return RcpLecturesQuery
     */
    public static function create($modelAlias = null, $criteria = null)
    {
        if ($criteria instanceof RcpLecturesQuery) {
            return $criteria;
        }
        $query = new RcpLecturesQuery();
        if (null !== $modelAlias) {
            $query->setModelAlias($modelAlias);
        }
        if ($criteria instanceof Criteria) {
            $query->mergeWith($criteria);
        }

        return $query;
    }

    /**
     * Find object by primary key.
     * Propel uses the instance pool to skip the database if the object exists.
     * Go fast if the query is untouched.
     *
     * <code>
     * $obj  = $c->findPk(12, $con);
     * </code>
     *
     * @param mixed $key Primary key to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return   RcpLectures|RcpLectures[]|mixed the result, formatted by the current formatter
     */
    public function findPk($key, $con = null)
    {
        if ($key === null) {
            return null;
        }
        if ((null !== ($obj = RcpLecturesPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
            // the object is alredy in the instance pool
            return $obj;
        }
        if ($con === null) {
            $con = Propel::getConnection(RcpLecturesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        if ($this->formatter || $this->modelAlias || $this->with || $this->select
         || $this->selectColumns || $this->asColumns || $this->selectModifiers
         || $this->map || $this->having || $this->joins) {
            return $this->findPkComplex($key, $con);
        } else {
            return $this->findPkSimple($key, $con);
        }
    }

    /**
     * Find object by primary key using raw SQL to go fast.
     * Bypass doSelect() and the object formatter by using generated code.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return   RcpLectures A model object, or null if the key is not found
     * @throws   PropelException
     */
    protected function findPkSimple($key, $con)
    {
        $sql = 'SELECT ID, GROUP_NAME_EN, GROUP_NAME_PL, LANGUAGE_NAME_PL, LANGUAGE_NAME_EN, TEACHER_ID, LAST_MODIFIED, CREATED FROM lectures WHERE ID = :p0';
        try {
            $stmt = $con->prepare($sql);
            $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
            $stmt->execute();
        } catch (Exception $e) {
            Propel::log($e->getMessage(), Propel::LOG_ERR);
            throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
        }
        $obj = null;
        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $obj = new RcpLectures();
            $obj->hydrate($row);
            RcpLecturesPeer::addInstanceToPool($obj, (string) $key);
        }
        $stmt->closeCursor();

        return $obj;
    }

    /**
     * Find object by primary key.
     *
     * @param     mixed $key Primary key to use for the query
     * @param     PropelPDO $con A connection object
     *
     * @return RcpLectures|RcpLectures[]|mixed the result, formatted by the current formatter
     */
    protected function findPkComplex($key, $con)
    {
        // As the query uses a PK condition, no limit(1) is necessary.
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKey($key)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
    }

    /**
     * Find objects by primary key
     * <code>
     * $objs = $c->findPks(array(12, 56, 832), $con);
     * </code>
     * @param     array $keys Primary keys to use for the query
     * @param     PropelPDO $con an optional connection object
     *
     * @return PropelObjectCollection|RcpLectures[]|mixed the list of results, formatted by the current formatter
     */
    public function findPks($keys, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
        }
        $this->basePreSelect($con);
        $criteria = $this->isKeepQuery() ? clone $this : $this;
        $stmt = $criteria
            ->filterByPrimaryKeys($keys)
            ->doSelect($con);

        return $criteria->getFormatter()->init($criteria)->format($stmt);
    }

    /**
     * Filter the query by primary key
     *
     * @param     mixed $key Primary key to use for the query
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterByPrimaryKey($key)
    {

        return $this->addUsingAlias(RcpLecturesPeer::ID, $key, Criteria::EQUAL);
    }

    /**
     * Filter the query by a list of primary keys
     *
     * @param     array $keys The list of primary key to use for the query
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterByPrimaryKeys($keys)
    {

        return $this->addUsingAlias(RcpLecturesPeer::ID, $keys, Criteria::IN);
    }

    /**
     * Filter the query on the id column
     *
     * Example usage:
     * <code>
     * $query->filterById(1234); // WHERE id = 1234
     * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
     * $query->filterById(array('min' => 12)); // WHERE id > 12
     * </code>
     *
     * @param     mixed $id The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterById($id = null, $comparison = null)
    {
        if (is_array($id) && null === $comparison) {
            $comparison = Criteria::IN;
        }

        return $this->addUsingAlias(RcpLecturesPeer::ID, $id, $comparison);
    }

    /**
     * Filter the query on the group_name_en column
     *
     * Example usage:
     * <code>
     * $query->filterByGroupNameEn('fooValue');   // WHERE group_name_en = 'fooValue'
     * $query->filterByGroupNameEn('%fooValue%'); // WHERE group_name_en LIKE '%fooValue%'
     * </code>
     *
     * @param     string $groupNameEn The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterByGroupNameEn($groupNameEn = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($groupNameEn)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $groupNameEn)) {
                $groupNameEn = str_replace('*', '%', $groupNameEn);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpLecturesPeer::GROUP_NAME_EN, $groupNameEn, $comparison);
    }

    /**
     * Filter the query on the group_name_pl column
     *
     * Example usage:
     * <code>
     * $query->filterByGroupNamePl('fooValue');   // WHERE group_name_pl = 'fooValue'
     * $query->filterByGroupNamePl('%fooValue%'); // WHERE group_name_pl LIKE '%fooValue%'
     * </code>
     *
     * @param     string $groupNamePl The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterByGroupNamePl($groupNamePl = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($groupNamePl)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $groupNamePl)) {
                $groupNamePl = str_replace('*', '%', $groupNamePl);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpLecturesPeer::GROUP_NAME_PL, $groupNamePl, $comparison);
    }

    /**
     * Filter the query on the language_name_pl column
     *
     * Example usage:
     * <code>
     * $query->filterByLanguageNamePl('fooValue');   // WHERE language_name_pl = 'fooValue'
     * $query->filterByLanguageNamePl('%fooValue%'); // WHERE language_name_pl LIKE '%fooValue%'
     * </code>
     *
     * @param     string $languageNamePl The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterByLanguageNamePl($languageNamePl = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($languageNamePl)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $languageNamePl)) {
                $languageNamePl = str_replace('*', '%', $languageNamePl);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpLecturesPeer::LANGUAGE_NAME_PL, $languageNamePl, $comparison);
    }

    /**
     * Filter the query on the language_name_en column
     *
     * Example usage:
     * <code>
     * $query->filterByLanguageNameEn('fooValue');   // WHERE language_name_en = 'fooValue'
     * $query->filterByLanguageNameEn('%fooValue%'); // WHERE language_name_en LIKE '%fooValue%'
     * </code>
     *
     * @param     string $languageNameEn The value to use as filter.
     *              Accepts wildcards (* and % trigger a LIKE)
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterByLanguageNameEn($languageNameEn = null, $comparison = null)
    {
        if (null === $comparison) {
            if (is_array($languageNameEn)) {
                $comparison = Criteria::IN;
            } elseif (preg_match('/[\%\*]/', $languageNameEn)) {
                $languageNameEn = str_replace('*', '%', $languageNameEn);
                $comparison = Criteria::LIKE;
            }
        }

        return $this->addUsingAlias(RcpLecturesPeer::LANGUAGE_NAME_EN, $languageNameEn, $comparison);
    }

    /**
     * Filter the query on the teacher_id column
     *
     * Example usage:
     * <code>
     * $query->filterByTeacherId(1234); // WHERE teacher_id = 1234
     * $query->filterByTeacherId(array(12, 34)); // WHERE teacher_id IN (12, 34)
     * $query->filterByTeacherId(array('min' => 12)); // WHERE teacher_id > 12
     * </code>
     *
     * @see       filterByUsers()
     *
     * @param     mixed $teacherId The value to use as filter.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterByTeacherId($teacherId = null, $comparison = null)
    {
        if (is_array($teacherId)) {
            $useMinMax = false;
            if (isset($teacherId['min'])) {
                $this->addUsingAlias(RcpLecturesPeer::TEACHER_ID, $teacherId['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($teacherId['max'])) {
                $this->addUsingAlias(RcpLecturesPeer::TEACHER_ID, $teacherId['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(RcpLecturesPeer::TEACHER_ID, $teacherId, $comparison);
    }

    /**
     * Filter the query on the last_modified column
     *
     * Example usage:
     * <code>
     * $query->filterByLastModified('2011-03-14'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified('now'); // WHERE last_modified = '2011-03-14'
     * $query->filterByLastModified(array('max' => 'yesterday')); // WHERE last_modified > '2011-03-13'
     * </code>
     *
     * @param     mixed $lastModified The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterByLastModified($lastModified = null, $comparison = null)
    {
        if (is_array($lastModified)) {
            $useMinMax = false;
            if (isset($lastModified['min'])) {
                $this->addUsingAlias(RcpLecturesPeer::LAST_MODIFIED, $lastModified['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($lastModified['max'])) {
                $this->addUsingAlias(RcpLecturesPeer::LAST_MODIFIED, $lastModified['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(RcpLecturesPeer::LAST_MODIFIED, $lastModified, $comparison);
    }

    /**
     * Filter the query on the created column
     *
     * Example usage:
     * <code>
     * $query->filterByCreated('2011-03-14'); // WHERE created = '2011-03-14'
     * $query->filterByCreated('now'); // WHERE created = '2011-03-14'
     * $query->filterByCreated(array('max' => 'yesterday')); // WHERE created > '2011-03-13'
     * </code>
     *
     * @param     mixed $created The value to use as filter.
     *              Values can be integers (unix timestamps), DateTime objects, or strings.
     *              Empty strings are treated as NULL.
     *              Use scalar values for equality.
     *              Use array values for in_array() equivalent.
     *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function filterByCreated($created = null, $comparison = null)
    {
        if (is_array($created)) {
            $useMinMax = false;
            if (isset($created['min'])) {
                $this->addUsingAlias(RcpLecturesPeer::CREATED, $created['min'], Criteria::GREATER_EQUAL);
                $useMinMax = true;
            }
            if (isset($created['max'])) {
                $this->addUsingAlias(RcpLecturesPeer::CREATED, $created['max'], Criteria::LESS_EQUAL);
                $useMinMax = true;
            }
            if ($useMinMax) {
                return $this;
            }
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }
        }

        return $this->addUsingAlias(RcpLecturesPeer::CREATED, $created, $comparison);
    }

    /**
     * Filter the query by a related RcpUsers object
     *
     * @param   RcpUsers|PropelObjectCollection $users The related object(s) to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpLecturesQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByUsers($users, $comparison = null)
    {
        if ($users instanceof RcpUsers) {
            return $this
                ->addUsingAlias(RcpLecturesPeer::TEACHER_ID, $users->getId(), $comparison);
        } elseif ($users instanceof PropelObjectCollection) {
            if (null === $comparison) {
                $comparison = Criteria::IN;
            }

            return $this
                ->addUsingAlias(RcpLecturesPeer::TEACHER_ID, $users->toKeyValue('PrimaryKey', 'Id'), $comparison);
        } else {
            throw new PropelException('filterByUsers() only accepts arguments of type RcpUsers or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the Users relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function joinUsers($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('Users');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'Users');
        }

        return $this;
    }

    /**
     * Use the Users relation Users object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpUsersQuery A secondary query class using the current class as primary query
     */
    public function useUsersQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinUsers($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'Users', 'RcpUsersQuery');
    }

    /**
     * Filter the query by a related RcpLecutreHourDefs object
     *
     * @param   RcpLecutreHourDefs|PropelObjectCollection $lecutreHourDefs  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpLecturesQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByLecutreHourDefs($lecutreHourDefs, $comparison = null)
    {
        if ($lecutreHourDefs instanceof RcpLecutreHourDefs) {
            return $this
                ->addUsingAlias(RcpLecturesPeer::ID, $lecutreHourDefs->getLectureId(), $comparison);
        } elseif ($lecutreHourDefs instanceof PropelObjectCollection) {
            return $this
                ->useLecutreHourDefsQuery()
                ->filterByPrimaryKeys($lecutreHourDefs->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByLecutreHourDefs() only accepts arguments of type RcpLecutreHourDefs or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the LecutreHourDefs relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function joinLecutreHourDefs($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('LecutreHourDefs');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'LecutreHourDefs');
        }

        return $this;
    }

    /**
     * Use the LecutreHourDefs relation LecutreHourDefs object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpLecutreHourDefsQuery A secondary query class using the current class as primary query
     */
    public function useLecutreHourDefsQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinLecutreHourDefs($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'LecutreHourDefs', 'RcpLecutreHourDefsQuery');
    }

    /**
     * Filter the query by a related RcpLecutreHours object
     *
     * @param   RcpLecutreHours|PropelObjectCollection $lecutreHours  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpLecturesQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByLecutreHours($lecutreHours, $comparison = null)
    {
        if ($lecutreHours instanceof RcpLecutreHours) {
            return $this
                ->addUsingAlias(RcpLecturesPeer::ID, $lecutreHours->getLectureId(), $comparison);
        } elseif ($lecutreHours instanceof PropelObjectCollection) {
            return $this
                ->useLecutreHoursQuery()
                ->filterByPrimaryKeys($lecutreHours->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByLecutreHours() only accepts arguments of type RcpLecutreHours or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the LecutreHours relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function joinLecutreHours($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('LecutreHours');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'LecutreHours');
        }

        return $this;
    }

    /**
     * Use the LecutreHours relation LecutreHours object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpLecutreHoursQuery A secondary query class using the current class as primary query
     */
    public function useLecutreHoursQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinLecutreHours($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'LecutreHours', 'RcpLecutreHoursQuery');
    }

    /**
     * Filter the query by a related RcpUserHasLecture object
     *
     * @param   RcpUserHasLecture|PropelObjectCollection $userHasLecture  the related object to use as filter
     * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
     *
     * @return   RcpLecturesQuery The current query, for fluid interface
     * @throws   PropelException - if the provided filter is invalid.
     */
    public function filterByUserHasLecture($userHasLecture, $comparison = null)
    {
        if ($userHasLecture instanceof RcpUserHasLecture) {
            return $this
                ->addUsingAlias(RcpLecturesPeer::ID, $userHasLecture->getLectureId(), $comparison);
        } elseif ($userHasLecture instanceof PropelObjectCollection) {
            return $this
                ->useUserHasLectureQuery()
                ->filterByPrimaryKeys($userHasLecture->getPrimaryKeys())
                ->endUse();
        } else {
            throw new PropelException('filterByUserHasLecture() only accepts arguments of type RcpUserHasLecture or PropelCollection');
        }
    }

    /**
     * Adds a JOIN clause to the query using the UserHasLecture relation
     *
     * @param     string $relationAlias optional alias for the relation
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function joinUserHasLecture($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        $tableMap = $this->getTableMap();
        $relationMap = $tableMap->getRelation('UserHasLecture');

        // create a ModelJoin object for this join
        $join = new ModelJoin();
        $join->setJoinType($joinType);
        $join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
        if ($previousJoin = $this->getPreviousJoin()) {
            $join->setPreviousJoin($previousJoin);
        }

        // add the ModelJoin to the current object
        if ($relationAlias) {
            $this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
            $this->addJoinObject($join, $relationAlias);
        } else {
            $this->addJoinObject($join, 'UserHasLecture');
        }

        return $this;
    }

    /**
     * Use the UserHasLecture relation UserHasLecture object
     *
     * @see       useQuery()
     *
     * @param     string $relationAlias optional alias for the relation,
     *                                   to be used as main alias in the secondary query
     * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
     *
     * @return   RcpUserHasLectureQuery A secondary query class using the current class as primary query
     */
    public function useUserHasLectureQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
    {
        return $this
            ->joinUserHasLecture($relationAlias, $joinType)
            ->useQuery($relationAlias ? $relationAlias : 'UserHasLecture', 'RcpUserHasLectureQuery');
    }

    /**
     * Exclude object from result
     *
     * @param   RcpLectures $lectures Object to remove from the list of results
     *
     * @return RcpLecturesQuery The current query, for fluid interface
     */
    public function prune($lectures = null)
    {
        if ($lectures) {
            $this->addUsingAlias(RcpLecturesPeer::ID, $lectures->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }

}
